package com.veeder.datacollection.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;




public class DateUtil {
	
	 public static String DateFormat1 = "yyMMddHHmm";
	 public static String DateFormat2 = "yyMMddHHmmss";
	 public static String DateFormat3 = "yyyy-MM-dd HH:mm:ss";
	 public static String DateFormat4 = "yyyyMMdd";
	 public static String DateFormat5 = "yyyy-MM-dd";
	 public static String DateFormat6 = "yyyy-MM-dd HH:mm:ss:SSS";

    public static Date convertToDate(String dateStr, String format) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
		return sdf.parse(dateStr);
		
    }  
  
 
    public static String formatDate(Date date, String format){
    	 if(date==null){
    		 return null;
    	 }
    	 SimpleDateFormat sdf = new SimpleDateFormat(format);
    	 return sdf.format(date);
    }
    
    
    
    
}
